package com.commons.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author mis_wu
 * @date 2021/12/24 10:49
 * 随机头像分派
 */
public class AvatarRandom {

    private static final Logger log = LoggerFactory.getLogger(AvatarRandom.class);

    private static Map<Integer,String> randomAvatar=null;
    public static String getAvatarPath(){
        randomAvatar = new HashMap<>();
        randomAvatar.put(1,"https://s4.ax1x.com/2021/12/24/TYEEkQ.jpg");
        randomAvatar.put(2,"https://s4.ax1x.com/2021/12/27/TDwgKO.jpg");
        randomAvatar.put(3,"https://s4.ax1x.com/2021/12/24/TtrIWF.jpg");
        randomAvatar.put(4,"https://s4.ax1x.com/2021/12/27/TDwqsS.jpg");
        randomAvatar.put(5,"https://s4.ax1x.com/2021/12/27/TD0NWt.jpg");
        int random= (int)(1+Math.random()*(5-1+1));
        Set<Integer> keys = randomAvatar.keySet();
        for (Integer key : keys) {
            if (key == random){
                return randomAvatar.get(key);
            }
        }
        return null;
    }

}
